Package-level declarations

Package that contains the DidDht class, which is used to create and resolve dids using the dht method.

Examples

Creation

Creating a DID DHT

package example

import web5.sdk.crypto.InMemoryKeyManager
import web5.sdk.dids.methods.dht.DidDht
import web5.sdk.dids.methods.dht.CreateDidDhtOptions
import foundation.identity.did.Service

val keyManager = InMemoryKeyManager()

// Add a service to the DID Document
val service = Service.Builder()
.id(URI("test-service"))
.type("HubService")
.serviceEndpoint("https://example.com/service)")
.build()

val opts = CreateDidDhtOptions(
services = listOf(service),
// Automatically publishes to the DHT
publish = true
)

val did = DidDht.create(keyManager, opts)

Resolution

Resolve a DID DHT

val did = DidDht.resolve("did:dht:gb46emk73wkenrut43ii67a3o5qctojcaucebth7r83pst6yeh8o")

Types

Link copied to clipboard
class CreateDidDhtOptions(val verificationMethods: Iterable<<Error class: unknown class><Jwk, List<Purpose>, String?>>? = null, val services: Iterable<Service>? = null, val publish: Boolean = true, val controllers: Iterable<String>? = null, val alsoKnownAses: Iterable<String>? = null) : CreateDidOptions

Specifies options for creating a new "did:dht" Decentralized Identifier (DID).

Link copied to clipboard
class DidDht(val uri: String, val keyManager: KeyManager, val didDocument: DidDocument? = null)

Provides a specific implementation for creating and resolving "did:dht" method Decentralized Identifiers (DIDs).

Link copied to clipboard
sealed class DidDhtApi(configuration: DidDhtConfiguration)

Base class for managing DID DHT operations. Uses the given DidDhtConfiguration.

Link copied to clipboard

Configuration for the DidDhtApi.

Link copied to clipboard
class DidDhtDocumentMetadata(val types: List<Int>? = null) : DidDocumentMetadata

Did document metadata for did:dht that extends the base did document metadata.

Link copied to clipboard

Type indexing types as per https://tbd54566975.github.io/did-dht-method/#type-indexing

Functions

Link copied to clipboard
fun DidDhtApi(configurationBlock: DidDhtConfiguration.() -> Unit): DidDhtApi

Returns a DidDhtApi after applying configurationBlock on the default DidDhtConfiguration.